dn: cn=config
changetype: modify
replace: olcServerID
{% for host in slapd_servers %}
olcServerID: {{ loop.index }} {% if slapd_ssl | bool %}ldaps{% else %}ldap{% endif %}://{{ host }}
{% endfor %}
{% if slapd_servers | length > 1 %}

dn: olcOverlay=syncprov,olcDatabase={0}config,cn=config
changetype: add
objectClass: olcOverlayConfig
objectClass: olcSyncProvConfig
olcOverlay: syncprov

dn: olcDatabase={0}config,cn=config
changetype: modify
add: olcSyncRepl
{% for host in slapd_servers %}
olcSyncRepl: rid=00{{ loop.index }}
  provider={% if slapd_ssl | bool %}ldaps{% else %}ldap{% endif %}://{{ host }}
  binddn="cn=config"
  bindmethod=simple
{% if slapd_ssl | bool %}
  starttls=yes
  tls_cert="{{ slapd_cert_path }}/server.crt"
  tls_key="{{ slapd_cert_path }}/server.key"
  tls_cacert="{{ slapd_cert_path }}/ca-cert.pem"
  tls_reqcert=demand
{% endif %}
  credentials={{ slapd_root_pass }}
  schemachecking=on
  searchbase="cn=config"
  type=refreshAndPersist
  retry="5 5 300 5"
  timeout=10
{% endfor %}
-
add: olcMirrorMode
olcMirrorMode: TRUE
{% endif %}
